<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/


Route::name('home.')->namespace('Home')->group(function () {
    Route::name('article.')->group(function () {
        Route::get('/', ArticleController::class . '@index')->name('index');
        Route::get('/article/{article}', ArticleController::class . '@show')->name('show');
        });
        Route::get('/category/{category}', 'CategoryController@show');
        Route::get('/tag/{tag}', 'TagController@show');
});

Auth::routes();
Route::get('/blog', 'HomeController@index')->name('home');

//后台路由
Route::get('/admin',function (){
    return redirect('/admin/index');
});
Route::prefix('admin')->middleware('auth')->namespace('Admin')->group(function (){
	//后台首页
    Route::resource('index','IndexController');
    Route::resource('user','UserController');
        Route::get('user/destroy/{id}', 'UserController@destroy'); //删除
        Route::get('user/restore/{id}', 'UserController@restore'); //恢复
        Route::get('user/forceDelete/{id}', 'UserController@forceDelete'); //彻底删除
//文章管理
    Route::resource('article','ArticleController');
    Route::get('article/destroy/{id}', 'ArticleController@destroy'); //删除
        Route::get('article/restore/{id}', 'ArticleController@restore'); // 彻底删除
        Route::get('article/forceDelete/{id}', 'ArticleController@forceDelete');
        Route::get('articles/replaceView','ArticleController@replaceView');
        Route::post('articles/replace', 'ArticleController@replace');//替换
    //分类
    Route::resource('category','CategoryController');
   Route::post('category/sort', 'CategoryController@sort');//排序
        Route::get('category/destroy/{id}', 'CategoryController@destroy');   // 删除分类
        Route::get('category/restore/{id}', 'CategoryController@restore');   //恢复 删除分类
        Route::get('category/forceDelete/{id}', 'CategoryController@forceDelete');// 彻底删除分类
//栏目
    Route::resource('nav','NavController');
    Route::post('nav/sort', 'NavController@sort');
        Route::get('nav/destroy/{id}', 'NavController@destroy'); //恢复 删除
        Route::get('nav/restore/{id}', 'NavController@restore'); // 彻底删除
        Route::get('nav/forceDelete/{id}', 'NavController@forceDelete');
        //标签
    Route::resource('tag','TagController');
    Route::get('tag/destroy/{id}', 'TagController@destroy');//恢复 删除
        Route::get('tag/restore/{id}', 'TagController@restore');// 彻底删除
        Route::get('tag/forceDelete/{id}', 'TagController@forceDelete');
        //友情链接
    Route::resource('friendshipLink','FriendshipLinkController');
    Route::post('friendshipLink/sort', 'FriendshipLinkController@sort');
        Route::get('friendshipLink/destroy/{id}', 'FriendshipLinkController@destroy'); //删除
        Route::get('friendshipLink/restore/{id}', 'FriendshipLinkController@restore'); // 彻底删除
        Route::get('friendshipLink/forceDelete/{id}', 'FriendshipLinkController@forceDelete');
     //配置系统
    Route::get('config/edit', 'ConfigController@edit');
    Route::get('config/email', 'ConfigController@email');

    Route::post('config/update', 'ConfigController@update');
    Route::get('config/clear', 'ConfigController@clear');
    Route::get('config/seo', 'ConfigController@seo');
});
